sussi = input()
spisok = []
ot = 0
za = 0
sussybaka = []
for i in sussi:
  if i in '()[]{}<>':
     spisok.append(i)
if len(spisok) % 2 == 0:
  for i in range(len(spisok)):
     if spisok[i] == '(':
        sussybaka.append(1)
     elif spisok[i] == '[':
        sussybaka.append(2)
     elif spisok[i] == '{':
        sussybaka.append(3)
     elif spisok[i] == '<':
        sussybaka.append(4)
     elif spisok[i] == ')' and sussybaka[-1] == 1:
        sussybaka.pop()
     elif spisok[i] == ']' and sussybaka[-1] == 2:
        sussybaka.pop()
     elif spisok[i] == '}' and sussybaka[-1] == 3:
        sussybaka.pop()
     elif spisok[i] == '>' and sussybaka[-1] == 4:
        sussybaka.pop()
  if sussybaka:
     print('False')
  else:
     print('True')
else:
  print('False')